<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	template="/WEB-INF/templates/default.xhtml">
	
	<ui:define name="content">

		<h:form id="taskTypeListForm" rendered = "#{login.loggedIn}">
			<p:dataTable 
				id="taskTypeTable"
				value="#{taskTypeListBean.loadTaskTypesForUser(currentUser)}"
				var="tt"
				style="width: 50%">
				
				<p:column>
					<f:facet name="header">Task Type name</f:facet>
					<h:outputText value="#{tt.name}" />
				</p:column>
				
				<p:column>
					<f:facet name="header">Tasks number</f:facet>
					<h:outputText value="#{tt.usertasks.size()}" />
				</p:column>
				
				<p:column>
					<f:facet name="header">Operations</f:facet>
					<p:button 
						value="Edit" 
						outcome="/content/tasktype/edit">
						<f:param name="id" value="#{tt.id}" />
					</p:button>
				</p:column>
			
			</p:dataTable>
			<br />
			<p:button
				value="Create new"
				outcome="/content/tasktype/edit" />
		</h:form>

	</ui:define>
</ui:composition>
